#pragma once

#include <QtWidgets/QWidget>
#include "ui_Server.h"
#include <QSharedPointer>
#include <QJsonDocument>
#include <QJsonValue>
#include <QJsonObject>
#include <QTCPSocket>
#include <QTCPServer>
#include <QDebug>

#include "http/qnetworkhttpserver.h"

class Server : public QWidget
{
    Q_OBJECT

public:
    Server(QWidget *parent = nullptr);
    ~Server();

    void initHttp();
    void initTCP();
    void stopServer();

public slots:
    void slot_newConnection();
    void slot_disconnected();
    void slot_reciveData();

private:
    Ui::ServerClass ui;
    QSharedPointer<QNetworkHttpServer> m_httpServer;
    
    QTcpServer m_server;
    QSet<QTcpSocket*> m_clientSockets;
};
